#include "recordclassmodel.h"
#include "database/dbtabrecordclass.h"

const char* RecordClassModel::chkresultStr[]={"无","R1","R2","R3","R4","R5","R6","R7","R8","R9","R10","R11","R12"};
RecordClassModel::RecordClassModel(QObject* parent):QSqlTableModel(parent)
{

}


QVariant RecordClassModel::data(const QModelIndex &index, int role) const
{
    if(!index.isValid())
            return QVariant();
    QVariant value=QSqlTableModel::data(index,role);
    switch(role)
    {
        case Qt::TextAlignmentRole:
            return Qt::AlignCenter;
            break;
//        case Qt::FontRole:
//            return QFont("Ubantu Medium",20,20);
//            break;
        case Qt::DisplayRole:
            if(index.column()==DBTabRecordClass::INDEX_CHKRESULT)
            {
                int iValue = value.toInt();
                return chkresultStr[iValue];
            }
            else
            {
                return value;
            }
            break;
        default:
            return value;
            break;
    }
    return QVariant();
}
